﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. 
// See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Fabric.Description;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ActorRuntimeManager
{
    public partial class LaunchAppAlias : Form
    {
        private string m_appName;
        public bool Successful { get; set; }

        public LaunchAppAlias(string actorAppName)
        {
            Successful = false;
            m_appName = actorAppName;
            InitializeComponent();
            this.labelActorApp.Text = actorAppName;
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            var fabricAppName = this.textBoxAlias.Text;
            MainForm.Client.ApplicationManager.CreateApplicationAsync(new ApplicationDescription(new Uri(fabricAppName), m_appName, "1.0")).Wait();
            Successful = true;
            this.Close();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
